import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            // 首页
            path: '/home',
            component: () => import('../views/Home.vue')
        },
        {
            // 我的音乐
            path: '/music',
            component: () => import('../views/MyMusic.vue')
        },
        {
            // 榜单
            path: '/list',
            component: () => import('../views/List.vue')
        },
        {
            // 歌单
            path: '/songSheet',
            component: () => import('../views/SongSheet.vue')
        },
        {
            // 歌手
            path: '/singer',
            component: () => import('../views/Singer.vue')
        },
        {
            // 音乐人
            path: '/musician',
            component: () => import('../views/Musician.vue')
        },
        {
            // 个人主页
            path: '/user',
            component: () => import('../views/User.vue'),
            children: [
                {
                    path: 'home',
                    component: () => import('../components/UserHome.vue')
                },
                {
                    path: 'event',
                    component: () => import('../components/UserEvent.vue')
                },
                {
                    path: 'follows',
                    component: () => import('../components/UserFollows.vue')
                },
                {
                    path: 'fans',
                    component: () => import('../components/UserFans.vue')
                }
            ],
            redirect: '/user/home'
        },
        {
            // 编辑个人资料页面
            path: '/update',
            component: () => import('../views/Update.vue')
        },
        {
            // 登录
            path: '/login',
            component: () => import('../views/Login.vue')
        },
        {
            // 注册
            path: '/register',
            component: () => import('../views/Register.vue')
        },
        {
            // 未找到页面跳转到首页
            path: '/*',
            redirect: '/home'
        }
    ]
})

export default router